package ExerciseOne;

public class ExceptionTest {
	public static void main(String[] args) {
		Test t = new Test();
		try {
			t.set(-2);
		} catch (MyException e) {
			System.out.println(e.getMessage());
		}
	}
	

}


class Test
{
	int id;
	public void set(int id) throws MyException
	{
		if(id>0)
		{
			this.id = id;
		}
		else
		{
			throw new RuntimeException("不能输入负数");
		}
	}
}